The present invention related to memory management, and in particular, to memory management for computer systems including file servers.
Networked computer systems typically include at least one file server data processing system. A file server can comprise a computer including a processor, memory, communication interface, and storage device such as a disk drive, configured by a file system program to provide file server functions. The performance of a file server is dependent upon several factors, one of the most important of which is the amount of physical memory (e.g., RAM) available for buffering/caching disk reads/writes. The limited amount of memory leads to intense competition between the file system and other system needs for memory. Further, the speed of memory block allocation for buffering data upon demand degrades over time primarily due to memory fragmentation. Without an abundance of physical memory, efficient memory management is required to ensure sustained performance without degradation.
However, conventional memory management methods, while enhancing performance in one network environment, often degrade performance in another. Even within one network environment, load changes from hour to hour can very widely and static memory management and tuning methods lead to degradation of the file server performance in many circumstances. Some conventional methods attempt to manage competition for memory by adding more physical memory or by using virtual memory methods, which rely on paging memory to buffer data to and from the storage system (e.g., disk drive). However, adding more physical memory is costly, requires space and consumes power. Further, virtual memory methods invariably lead to slow processing and unacceptable file server performance as they defeat the purpose of file system caching. Other conventional systems attempt to solve memory fragmentation by threading adjacent memory blocks together when freed. However, memory rethreading takes time, leading to reduced file server performance.
There is, therefore, a need for a memory management method and system for network file servers which accelerates memory allocation/deallocation for buffering data, reduces memory fragmentation, increases available memory for the file server file system I/O buffers while optimizing the amount of memory available for other uses, and manages competition for different memory uses, across different network environments and over time within one network environment.
The present invention satisfies these needs. In one embodiment, the present invention provides a method of managing memory including the steps of: in response to requests for allocation of memory blocks that remain allocated for different durations, allocating each memory block from one of a plurality of regions in the memory based on the duration that the memory block is to remain allocated; and maintaining a plurality of memory segments of one or more sizes in the memory, and in response to a request for allocation of a memory block if the requested block size is less than a predetermined size, then allocating the requested block from among said segments, otherwise allocating the requested block from another portion of the memory.
Preferably, in response to requests for allocation of long term memory blocks, long term memory blocks are allocated from a first region of the memory; and in response to requests for allocation of short term memory blocks, short term memory blocks are allocated from a second region of the memory. The number of data segments are changed in relation to memory requests. Further at least a potion of the memory is apportioned for other use such as to a cache having one or more buffers. The cache buffers can be allocated for non-cache use, including increase the number of said data segments, and are then deallocated back to the cache.
In another aspect the present invention provides a memory manager including means for implementing the above steps in a computer system comprising memory and a CPU for managing the memory. Further, the present invention provides a computer program product comprising a computer readable medium including program logic for configuring said computer system to perform the steps of managing memory according to the present invention.